//WinMain Source File
//Executes Primary Game Loop

	//Include Files//
#include <Windows.h>
#include "GameManager.hpp"
#include "Debugger.hpp"

	//Globals and Constants//

	//Functions//

/**********************************************************************************************************************\
|	WinMain:		Primary Game Loop, Divides and calls all game functions											   |
\**********************************************************************************************************************/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{	
	g_Debug->GetInstance().Init("DOOM Ultimate Debugger");
		//Variables//
	GameManager GM;
	MSG uMsg;												//Contains message information from a thread's message queue.

		//Initialize//
	GM.Init(nCmdShow);
	memset(&uMsg, 0, sizeof(uMsg));							//Set Messages to 0
	
		//Game Loop//
	while(uMsg.message != WM_QUIT)							//Program will run until a WM_QUIT message is sent 
	{
		while(PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE))	//Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).
		{
			TranslateMessage(&uMsg);						//Translates virtual-key messages into character messages.
			DispatchMessage(&uMsg);							//Dispatches a message to a window procedure.
		}
			//Update//
		GM.Update();

			//Render//
		GM.Render();
	}

		//Exit//
	GM.Exit();
	g_Debug->GetInstance().Exit();
}	//end WinMain